{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example Notebook to demonstrate how to start qkit"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### First import QKIT\n",
    "this imports the basic qkit module and initializes the configuration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import qkit"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The dictionary ** qkit.cfg ** holds the central configuration\n",
    "of the qkit framework\n",
    "\n",
    "The default values are set in the file ** qkit/config/environment.py ** \n",
    "and the file ** qkit/config/local.py ** if it exists."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### To show its contents one can e.g. use"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pprint import pprint\n",
    "pprint(qkit.cfg)\n",
    "# or simply \"qkit.cfg\" in an jupyter cell"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### If one wants to change a setting, there are two main options:\n",
    "  * change the setting in qkit/config/local.py ** before ** importing qkit\n",
    "  * or by directly manipulating the dictionary ** after ** importing qkit\n",
    "    like this:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "qkit.cfg['datadir'] =  r'my special root data folder'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### to start the full environment, execute qkit.start()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "qkit.start()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This starts the qkit environment with a set of services, e.g:\n",
    "  * a zmq info service to distribute updates on measurements\n",
    "  * a zerorpc service to to allow specific commands from remote\n",
    "  * the file service database module \n",
    "  * a device (instrument) database service \n",
    "  * etc.\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Now you can execute the measurement, analysis or similar script"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
